package com.apes.project.jekunAuto.intf.scm;

import com.apes.framework.plugin.esb.api.SimpleRequest;
import com.apes.framework.query.SqlService;
import com.apestech.framework.json.JSON;
import com.apestech.framework.json.JSONObject;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("intfMasterdataService")
public class masterdataService {
    SqlService sqlService;

    public String getEnumerationForApp(SimpleRequest request){
        JSONObject json = new JSONObject(request.getJO());

        JSONObject param = new JSONObject();
        String sSQL = "SELECT A.ID, A.DESCRIPTION, B.LAST_UPDATED_STAMP, A.ENUMERATION_TYPE_ID,\n" +
                "       B.DESCRIPTION ENUMERATION_TYPE_NAME\n" +
                "  FROM MAS_ENUMERATION A, MAS_ENUMERATION_TYPE B\n" +
                " WHERE A.ENUMERATION_TYPE_ID = B.ID AND TO_CHAR(B.LAST_UPDATED_STAMP, 'YYYYMMDD.HH24MISS.FF3') > #{TIMES} AND ROWNUM <= 1000";

        try {
            param.put("TIMES", json.getString("TIMESTAMP"));
            List list = sqlService.query("customComplain.queryCustomComplainForApp", param);
            return JSON.toJSONStringWithDateFormat(list);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }





}
